package com.yinxin.sychornized;

import com.yinxin.util.ThreadUtil;

import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @author yinxin
 * @Title:
 * @Package
 * @Description:
 * @date 2022/1/914:45
 */
public class TestJUC {
    public static void main(String[] args) {
        CopyOnWriteArrayList<String> list = new CopyOnWriteArrayList<>();
        for (int i = 0; i < 10000; i++) {
            new Thread(()->{
                list.add(Thread.currentThread().getName());
            }).start();
        }

        ThreadUtil.sleep(1000);

        System.out.println(list.size());

    }
}
